﻿using System.Data.Entity.ModelConfiguration;

namespace Delphi.Mimir.Data.Entities.Raw.Mappings {
    public class RawFundamentalsMap : EntityTypeConfiguration<RawFundamentals> {
        public RawFundamentalsMap() {
            /******************************************************************
            /* Table
            /*****************************************************************/
            ToTable("raw.eod_fundamentals");

            /******************************************************************
            /* Primary Key
            /*****************************************************************/
            HasKey(a => a.fun_id);

            /******************************************************************
            /* Index
            /*****************************************************************/
            // None

            /******************************************************************
            /* Relationships
            /*****************************************************************/
            // None

            /******************************************************************
            /* Properties
            /*****************************************************************/
            Property(a => a.fun_id )
                .IsRequired()
                .HasColumnName("fun_id");

            Property(a => a.fun_dt)
                .IsRequired()
                .HasColumnName("fun_dt");

            Property(a => a.fun_sym_cd)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("fun_sym_cd");

            Property(a => a.fun_exc_cd)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("fun_exc_cd");

            Property(a => a.fun_ind_desc)
                .IsOptional()
                .IsUnicode(false)
                .HasMaxLength(250)
                .HasColumnName("fun_ind_desc");

            Property(a => a.fun_sct_desc)
                .IsOptional()
                .IsUnicode(false)
                .HasMaxLength(250)
                .HasColumnName("fun_sct_desc");

            Property(a => a.fun_shares)
                .IsOptional()
                .HasColumnName("fun_shares");

            Property(a => a.fun_market_cap)
                .IsOptional()
                .HasColumnName("fun_market_cap");

            Property(a => a.fun_pe)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_pe");

            Property(a => a.fun_eps)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_eps");

            Property(a => a.fun_div_yield)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_div_yield");

            Property(a => a.fun_ebitda)
                .IsOptional()
                .HasColumnName("fun_ebitda");

            Property(a => a.fun_peg)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_peg");

            Property(a => a.fun_pts)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_pts");

            Property(a => a.fun_ptb)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_ptb");

            Property(a => a.fun_yield)
                .IsOptional()
                .HasPrecision(18, 6)
                .HasColumnName("fun_yield");
        }
    }
}
